<?php

namespace Api\InterfaceApi\v1;

use App\Music\Service\MusicSongService;
use Hyperf\Di\Annotation\Inject;
use Mine\Annotation\Api\MApi;
use Mine\MineRequest;
use Mine\MineResponse;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class MusicApi
{
    /**
     * @var MineRequest|mixed
     */
    private mixed $request;
    /**
     * @var MineResponse|mixed
     */
    private mixed $response;

    /**
     * 业务处理服务
     * MusicSongService
     */
    #[Inject]
    protected MusicSongService $service;

    /**
     * FaithApi constructor.
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function __construct()
    {
        $this->response = container()->get(MineResponse::class);
        $this->request = container()->get(MineRequest::class);

    }

    /**
     * 搜索功能.
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    #[MApi(accessName: 'songList', name: '搜索功能', description: '', appId: '3aed503b9a', groupId: 1)]
    public function songList(){
        $keyword = $this->request->input('keyword', '');
        $type = $this->request->input('type', 0);
        $page = $this->request->input('page', 1);
        $pageSize = $this->request->input('pageSize', 20);
        return $this->response->success('success',$this->service->getPageList($this->request->all()));
    }


}